home *** CD-ROM | disk | FTP | other *** search
/ The X-Philes (2nd Revision) / The X-Philes Number 1 (1995).iso / xphiles / hp48hor2 / qd.doc < prev    next >
Text File  |  1995-03-31  |  695b  |  22 lines

  1. (Comp.sys.hp48) 
  2. Item: 1120 by ERICLANE@UTCVM.BITNET 
  3. Author: [Prof. Eric T. Lane] 
  4.   Subj: Quad Challenge 
  5.   Date: Mon May 18 1992 19:49  
  6.  
  7. [Mini-instructions: Put quadratic equation's coefficients on the stack 
  8.  and press QD; see the two roots.  -jkh-] 
  9.  
  10. [Note: I asked the network readers if they could write a shorter 
  11.  quadratic solver than mine.  They sure could!  It became a contest of 
  12.  sorts, and the winner was this clever entry.  -jkh-] 
  13.  
  14. To solve the quadratic equation, try 
  15.  
  16. << 3 PICK / SWAP ROT -2 * / DUP SQ ROT - SQRT + LASTARG - >> 
  17.  
  18. which comes in at 50 bytes and 370 ticks.  There are faster routines 
  19. but they take up more bytes. 
  20.  
  21. Eric T. Lane 
  22.